﻿@{
    List<KeppelLand.Entities.Claim> claimList = PageData[0];
    KeppelLand.Entities.ClaimSummary claimSummary = PageData[1];
}
@if ((claimList != null) && (claimList.Count > 0))
{
    <h2>Retrieve Claims<b>*</b></h2>
    
    <p>
        Click on the Retrieve button to retrieve a claim that you have submitted for approval.<br/>
        <b>*</b>Only claims that not approve are retrievable.
    </p>

    <table class="table table-striped table-bordered custom-fullwidth" id="retrievable_claim_list">
        <thead>
            <tr>
                <td colspan="8"></td>
                <td colspan="5" class="text-nowrap" style="font-weight:bold; color:red;">No of overtime hours worked(excl. breaks)</td>
                <td colspan="4"></td>
            </tr>
            <tr>
                <th rowspan="2" style="width:136px">Claim Date</th>
                <th rowspan="2" style="width:90px">Shift Type <br />(for shift staff only)</th>
                <th colspan="2" class="text-center">Official Hours</th>
                <th colspan="2" style="width:1px" class="text-center">Overtime Hours</th>
                <th rowspan="2" style="width:55px" class="text-center">Total OT Hours</th>
                <th rowspan="2" style="width:55px" class="text-center">Break Hours</th>

                <th colspan="2" class="text-center">OT Rate <span class="glyphicon glyphicon-info-sign" style="color:black;font-size:large;cursor:pointer;vertical-align:middle;" title="Information" aria-hidden="true" onclick="javascript: $('#otRateModal').modal('show');"></span></th>
                <th rowspan="2" style="width:1px;cursor:default;text-align:center;" title="Public Holiday">PH</th>
                <th colspan="2" class="text-center" style="white-space:nowrap;">Rest Day</th>
                <th rowspan="2" style="width:90px;">Meal Allw($) <span class="glyphicon glyphicon-info-sign" style="color:black;font-size:large;cursor:pointer;vertical-align:middle;" title="Information" aria-hidden="true" onclick="javascript: $('#mealAllwModal').modal('show');"></span></th>
                <th rowspan="2" style="width:90px;"><span class="text-nowrap">Shift Allw($)</span><br />(for shift staff only)</th>
                <th rowspan="2">Description of Work Performed During Overtime Hours Worked</th>

                <th rowspan="2" style="width:176px;">Actions</th>
            </tr>
            <tr>
                <th style="white-space:nowrap;width:1px;">Start Time</th>
                <th style="white-space:nowrap;width:1px;">End Time&nbsp;</th>
                <th style="white-space:nowrap;width:1px;">Start Time</th>
                <th style="white-space:nowrap;width:1px;">End Time&nbsp;</th>
                <th style="white-space:nowrap;width:1px;text-align:center;">1.5 X</th>
                <th style="white-space:nowrap;width:1px;text-align:center;">2.0 X</th>
                <th style="white-space:nowrap;width:1px;text-align:center;">&lt;4</th>
                <th style="white-space:nowrap;width:1px;text-align:center;">&gt;4</th>
            </tr>
        </thead>
        <tbody>
            @foreach (KeppelLand.Entities.Claim c in claimList)
            {
                <tr>
                    <td white-space:nowrap;">@DisplayHelper.FormatDate(c.ClaimDate) (@DisplayHelper.FormatDayOfWeek(c.ClaimDate))</td>
                    <td>@c.ShiftType</td>
                    <td>@DisplayHelper.FormatTime(c.StartWorkTime)</td>
                    <td>@DisplayHelper.FormatTime(c.EndWorkTime)</td>
                    <td>@DisplayHelper.FormatTime(c.StartOverTime)</td>
                    <td>@DisplayHelper.FormatTime(c.EndOverTime)</td>
                    <td class="text-right">@c.TotalOTHours</td>
                    <td class="text-right">@c.BreakHours</td>

                    <td class="text-right">@DisplayHelper.FormatDecimal(c.OT1_5)</td>
                    <td class="text-right">@DisplayHelper.FormatDecimal(c.OT2_0)</td>
                    <td text-align:center; width:36px;">@DisplayHelper.FormatCheckmark(c.PH)</td>
                    <td text-align:center; width:36px;">@DisplayHelper.FormatCheckmark(c.RD4)</td>
                    <td text-align:center; width:36px;">@DisplayHelper.FormatCheckmark(c.RD8)</td>
                    <td class="text-right">@DisplayHelper.FormatMoney(c.AlwMeal)</td>
                    <td class="text-right">@DisplayHelper.FormatMoney(c.AlwShft)</td>

                    <td>@c.Remark</td>
                    <td>
                        <button type="button" name="actionButton" value="@(KeppelLand.Helpers.CryptographyHelper.Encrypt(c.Id.ToString()))" class="btn btn-primary btn-sm hidden-print"><span class="glyphicon glyphicon-arrow-left" aria-hidden="true"></span> Retrieve</button>
                    </td>
                </tr>
            }
        </tbody>
        @if (claimSummary != null)
        {
            <tfoot>
                <tr>
                    <th colspan="6" class="text-right">Total </th>
                    <td class="text-right">@DisplayHelper.FormatDecimal(claimSummary.Total_OT_Hours)</td>
                    <td class="text-right">@DisplayHelper.FormatDecimal(claimSummary.Break_Hours)</td>
                    <td class="text-right">@DisplayHelper.FormatDecimal(claimSummary.OT1_5)</td>
                    <td class="text-right">@DisplayHelper.FormatDecimal(claimSummary.OT2_0)</td>
                    <td class="text-center">@DisplayHelper.FormatInteger(claimSummary.PH)</td>
                    <td class="text-center">@DisplayHelper.FormatInteger(claimSummary.RD4)</td>
                    <td class="text-center">@DisplayHelper.FormatInteger(claimSummary.RD8)</td>
                    <td class="text-right">@DisplayHelper.FormatMoney(claimSummary.AlwMeal)</td>
                    <td class="text-right">@DisplayHelper.FormatMoney(claimSummary.AlwShft)</td>
                    <td colspan="2"></td>
                </tr>
            </tfoot>
        }
    </table>

<div>

</div>
}
else
{
    <h2>Retrieve Claims<b>*</b></h2>

    <p>
        Click on the Retrieve button to retrieve a claim that you have submitted for approval.<br />
        <b>*</b>Only claims that not approve are retrievable.
    </p>
    
    <p>There are no retrievable claims.</p>
}
<form method="post" id="approval_form">
    <input type="hidden" name="actionButton" id="actionButton" />
    <input type="hidden" name="actionId" id="actionId" />
    <input type="hidden" name="download_format" id="download_format" />
</form>

<p>&nbsp;</p>